var t = getApp();

Page({
    data: {
        language: "",
        mailLanguage: "",
        mailFullReturnTitle: "",
        mailFullReturnAmount: "",
        mailFullReturnName: "",
        order_amount: 0,
        return_amount: 0,
        status_name: "",
        each_return_rate: 0,
        return_mode: "",
        not_return: 0,
        order_sn: "",
        created_at: "",
        finish_time: "",
        id: ""
    },
    onLoad: function(t) {
        this.initMailLanguage(), this.getData(), this.setData({
            id: t.id
        });
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    initMailLanguage: function() {
        var a, n = this, e = t.getNetAddresss("setting.get-lang-setting");
        t._getNetWork({
            url: e,
            success: function(e) {
                var i = e.data;
                if (1 === i.result) {
                    a = i.data;
                    var u = t.setMailLanguage("赠送详情", a.full_return.return_detail), o = t.setMailLanguage("已赠送金额", a.full_return.return_amount), r = t.setMailLanguage("赠送", a.full_return.return_name);
                    n.setData({
                        mailLanguage: a,
                        mailFullReturnTitle: u,
                        mailFullReturnAmount: o,
                        mailFullReturnName: r
                    }), wx.setNavigationBarTitle({
                        title: u || ""
                    });
                } else wx.showToast({
                    title: i.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getData: function() {
        var a = this, n = t.getNetAddresss("plugin.full-return.frontend.detail.index");
        n += "&log_id=" + this.options.id, t._getNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 === n.result ? a.setData({
                    amount: n.data.item.amount,
                    ratio: n.data.item.info.ratio,
                    info: n.data.item.info,
                    turnover: n.data.item.info.turnover,
                    unit_price: n.data.item.info.unit_price,
                    amount_total: n.data.item.info.amount_total,
                    amount_surplus: n.data.item.info.amount_surplus,
                    created_at: n.data.item.created_at
                }) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});